var str = "";
$.ajax({
    url:"/RuanJianKeShe/getAllTeachCourses",
    type:"post",
    data:{
        "msg":"getAllTeachCourses",
    },
    dataType:"json",
    success:function(data){
        showAllSelectCourses(data.allTeachCourses);
    },
    error:function(){
        alert("fail");
    }
})
function showAllSelectCourses(data) {
    var str = "";
    for (var i = 0; i < data.length; i++) {
        str = "<tr>" +
            "<td>" + data[i].cno   + "</td>" +
            "<td>" + data[i].cname + "</td>" +
            "<td>"  + data[i].tno   + "</td>" +
            "<td>" + data[i].tname + "</td>" +
            "<td>"  + data[i].teachTime +"</td>" +
            "<td>"  + data[i].teachWeek + "</td>" +
            "<td>"  + "<button onclick=\"deleteHandle("+data[i].cno+","+data[i].tno+")\">删除</button>" +"</td>" +
            "<td></td>" +
            "</tr>";
        $("#tab").append(str);
    }
}
deleteHandle = function (data1,data2) {
    $.ajax({
        url:"/RuanJianKeShe/delTCInfo",
        type:"post",
        data:{
            "msg":"delTCInfo",
            "cno":data1,
            "tno":data2,
        },
        dataType:"json",
        success:function(success){
            alert(success)
        },
        error:function(){
            alert("fail");
        }
    })
    window.location.reload();
}
add = function () {
    window.location.href="../../../html/manager/add/addTCInfo.html"
}